<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
        function on_del_manager(index){
          var managers = $('#manager_table').datagrid('getRows');
          var workno = managers[index].workno;
          if (confirm('确定删除管理员['+workno+'('+managers[index].name+')]吗?'))
          {
            post_request('delManager.action',{workno:workno}, function (data){
              $.messager.alert('删除管理员', data.result.message, 'info');
              
              if (data.result.code=='0')
              {
                $('#manager_table').datagrid('deleteRow', index);
              }
            });
          }
        }
        function on_del_manager_ui(value,row,index){
          return '<a class="delclass" href="#" onclick="on_del_manager('+index+')">删除</a>';
        }
        function on_dept_node_clicked(node){
          if (node==null) return;
          var includeflag=$('#include_down_dept').attr('checked');
		  var obj = {deptno:node.id,includedown:includeflag};
          	new_data_grid('#manager_table', make_manager_table_fields('删除',
          		on_del_manager_ui),'queryManagersByDept.action', obj, 16); 
        }
    	$(document).ready(function(){
    	    var sel_dept_panel = $('#sel_manager_dept_pane').panel();
    	    set_dept_panel_ctrl(sel_dept_panel,'depttree');    	    

  			$('#include_down_dept').change(function(){
  			  var node=$('#depttree').tree('getSelected');
  			  on_dept_node_clicked(node);
  			});
    		
    		$('#depttree').tree({url:'queryDeptTree.action',onClick:on_dept_node_clicked,
    			onLoadError: function(){alert('系统错误，服务器可能已关闭！')}});
     		$('#del_manager_panel').panel({onClose:function(){
          		$("#sel_manager_dept_pane").panel("destroy");
     		}});
    	});
    </script>
	</head>
	<body>
	
    <div id="del_manager_panel" collapsible="false" fit="true" title="删除管理员" 
    	resizable="false" collapsible="false" minimizable="false" maximizable="false" 
    	closable="true" icon="icon-save" class="jquery_panel">
    	<table width="100%" height="94%">
    		<tr>
    			<td width="260px"><div id="sel_manager_dept_pane" collapsible="false" fit="true" 
    				title="选择管理员机构" resizable="false" collapsible="false" minimizable="false" 
    				maximizable="false" noheader="false" closable="false" 
    				style="margin:0px;padding:0px;overflow-y:scroll">
    				<ul id="depttree"></ul></div></td>
    			<td>
    			<table width="100%" height="100%">
    				<tr valign="top"><td ><table id="manager_table" title="管理员信息表" singleSelect="true" 
    					fit="true" fitColumns="true"></table>
    				</td>
    				</tr>
    				<tr><td width="100" height="1"></td></tr>
    			</table>
 				</td>
    		</tr>
    	</table>
    </div>
    
    </body>
</html>